import service from '@/utils/http'

// 用户登录
export const login = (data: { username: string; password: string }) => {
  return service.post('/api/login', data)
}

// 获取用户信息
export const getUserInfo = () => {
  return service.get('/api/user/info')
}

// 更新用户信息
export const updateUserInfo = (data: {
  nickname?: string
  avatar?: string
  email?: string
}) => {
  return service.put('/api/user/info', data)
}

// 登出
export const logout = () => {
  return service.post('/api/logout')
}
